package WaiBao;

import java.util.Arrays;

public class YangMengMeng {
    public static void main(String[] args) {
        String[] name = {"高得(班长)", "李晓凯(副班长)", "张合元(组织委员)", "王静(体育委员)", "李锦记", "李晶晶", "张晓伟", "王迅将", "王待遇", "王大锤", "李大彪", "刘晓阳",
                "王伦之", "薛之谦", "许嵩", "隔壁老樊", "韩星", "韩愈", "李荣浩", "杜甫", "李贺", "李白", "欧阳修", "上官婉儿", "程咬金", "廉颇", "蒙恬", "徐良",
                "周深", "杨萌萌(宣传委员)"};//考生本人:杨萌萌(宣传委员)
        int[] age = {22, 21, 20, 19, 18, 20, 21, 21, 19, 19, 18, 20, 18, 20, 21, 19, 20, 18, 18, 20, 19, 19, 20, 20, 21, 18, 20, 20, 19, 20};//考生年龄：20

        double[] xianyu1 = {80, 75, 87, 81, 76, 68, 74, 89, 80, 71, 74, 87, 85, 74, 75, 78, 69, 91, 92, 85, 72, 91, 75, 88, 70, 74, 72, 60, 71, 83};
        double[] xianyu2 = {64, 75, 78, 88, 84, 77, 74, 74, 73, 81, 83, 78, 87, 75, 84, 64, 71, 74, 76, 68, 82, 74, 68, 81, 77, 80, 76, 55, 70, 85};
        double[] xianyu3 = {76, 76, 71, 85, 78, 69, 70, 81, 84, 69, 63, 81, 85, 75, 68, 68, 69, 69, 96, 73, 92, 81, 90, 65, 79, 87, 79, 67, 64, 81};

        double luyin1;//代表每个学生的总分
        double luyin2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            luyin1 = xianyu1[i] +xianyu2[i] +xianyu3[i];
//            luyin2 = ( luyin1* 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + luyin1);
//            System.out.println(name[i] + "的平均分为:" +luyin2);
//        }

        double boji1 = 0,boji2 = 0;
        double[] banli = new double[30];
//        for (int i = 0; i < 30; i++) {
//            boji1 = xianyu1[i] + xianyu2[i] +xianyu3[i];
//            boji2 = (boji1 * 1.0) / 3;
//            banli[i] =boji2;
//        }
//
//        for (int i = 0; i <banli.length - 1; i++) {
//            for (int j = 0; j < banli.length - i - 1; j++) {
//                if (banli[j] < banli[j + 1]) {
//                    double tep = banli[j];
//                    banli[j] = banli[j + 1];
//                    banli[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(banli[i]);
//        }


        double ditu1 = 0,ditu2 = 0, ditu3 = 0;//计算每门课的平均分
        double ujing1 = 0,ujing2 = 0,ujing3 = 0;//计算每门课标准差
        double taiyuan1 = 0,taiyuan2 = 0,taiyuan3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i <xianyu1.length; i++) {
            sum2+=xianyu1[i];
        }
        ditu1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+ditu1);
        double Sum = 0;
        for (int i = 0; i <xianyu2.length; i++) {
            Sum+=xianyu2[i];
        }
        ditu2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+ditu2);
        double sum = 0;
        for (int i = 0; i <xianyu3.length; i++) {
            sum+=xianyu3[i];
        }
        ditu3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+ditu3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <xianyu1.length; i++) {
            c1+= (xianyu1[i] -ditu1)*(xianyu1[i] -ditu1);
        }
        ujing1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+ujing1);

        for (int i = 0; i < xianyu2.length; i++) {
            c2+= (xianyu2[i] -ditu2)*(xianyu2[i] - ditu2);
        }
        ujing2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+ujing2);

        for (int i = 0; i <xianyu3.length; i++) {
            c3+= (xianyu3[i] - ditu3)*(xianyu3[i] - ditu3);
        }
        ujing3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+ujing3);
////////////////
////////////////
        Arrays.sort(xianyu1);
        Arrays.sort(xianyu2);
        Arrays.sort(xianyu3);
        taiyuan1 =(xianyu1[14]+xianyu1[15])*1.0/2;
        taiyuan2 =(xianyu2[14]+xianyu2[15])*1.0/2;
        taiyuan3 =(xianyu3[14]+xianyu3[15])*1.0/2;
        System.out.println("生物化学的中位数为:"+taiyuan1);
        System.out.println("微生物学的中位数为:"+taiyuan2);
        System.out.println("人体组织解剖学的中位数为:"+taiyuan3);




    }
}
